/*****************************************************************************/
/**
*
* @file interrupt.c
*	@brief all configurations about NVIC and EXTI.
* Target device: STM32F103RET6.
*
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver   Who    Date   	Changes
* ----- ---- ---------- -------------------------------------------------------
* 0.01  abu  02/01/2020 Created
* </pre>
*
*------------------------------------------------------------------------------
* Author:	abu
*					E-mail:	abu_liu@opencores.org
*------------------------------------------------------------------------------
*
******************************************************************************/

/***************************** Include Files *********************************/
#include "bsp_interrupt.h"

/************************** Function Prototypes ******************************/

/*****************************************************************************/
/**
*
* @brief	NVIC configuration.
*					
* @param	None.
* @param  None.	
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
void NVIC_Configuration(void)
{
	NVIC_InitTypeDef NVIC_InitStructure;

	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);

	//set interrupt configurations for key4
	NVIC_InitStructure.NVIC_IRQChannel = KEY4_INT_EXTI_IRQ;
	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
	NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
	NVIC_Init(&NVIC_InitStructure);
	
	//set interrupt configurations for other peripherals
	//paste your codes below

}

/*****************************************************************************/
/**
*
* @brief	NVIC configuration.
*					
* @param	None.
* @param  None.	
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
void EXTI_Configuration(void)
{
	//open clock for AFIO
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);

	//initialise NVIC
	NVIC_Configuration();
	
	//Initialise interrupt inputs. Paste your codes behind
	Key4_Intr_Init();
}
